Answer:

Default Locale = en_GB
value = 123,456,789

The language is english and the country is Great Britain. Locales specify both language and country.

DecimalFormat Objects

The program creates a DecimalFormat object. The format() method of this object converts a number into a StringBuffer. A StringBuffer is almost the same as a String except it can be modified. No modification of a StringBuffer will be done in this chapter, so it will be treated exactly as if it were a String.

The default locale determines the format of this StringBuffer. The number may be a primitive (like int or double) or a wrapper object (like Integer or Double).

import java.util.Locale;
import java.text.*;

class IODemo2
{
  public static void main ( String[] args )
  {
    int value = 123456789 ;
    
    System.out.println( "Default Locale = " + Locale.getDefault() );
    DecimalFormat decform = new DecimalFormat();   
    System.out.println( "value = " + decform.format(value) );
  }
}

The program uses the default behavior of DecimalFormat.format(). Later you will see methods that further affect the output of format().

QUESTION 3:

(Review :) What three characters are used to separate the digits of an integer into groups of three?